{% extends 'base.html' %}
{% block header %}
    <h1>{% block title %}分析{% endblock %}</h1>
{% endblock %}

{% block user %}
    {% block username %}
        {{ username }}
    {% endblock %}
{% endblock %}

{% block content %}

    <div style="text-align: center;">
        <span style="font-size: 26px;"> 处理器得分分析 </span>
    </div>

    <div style="padding-top: 10px;">
        <form action="/contrastscatter" method="POST" name="crud_query" enctype=multipart/form-data>
            <input name="db_name" type="hidden" value={{ table_name }}>
            <div class="container" style="width: 80%; height: 80px; padding-top: 20px">
                <div class="row" style="text-align: center;">
                    <div class="col-sm">
                        <select name="res" class="selectpicker" title="选择处理器" multiple data-live-search="true"
                                data-live-search-placeholder="选择处理器" data-max-options="2">
                            {% for cc in cc_lst %}
                                <option value='{{ cc }}'>{{ cc }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="col-sm">
                        <button onclick="get_result()" type="button" class="btn btn-outline-primary btn-sm">对比</button>
                    </div>
                </div>
            </div>
        </form>
    </div>

    <div style="overflow-x:scroll; margin-left: 50px; margin-right: 50px">
        <div>
            <table class="table table-sm table-hover" style="min-height:500px;">
                <thead>
                <tr>
                    {% for col in tables.columns.tolist()[0:] %}
                        <th >
                            {{ col }}
                        </th>
                    {% endfor %}
                    <th>
                        详细信息
                    </th>
                </tr>

                </thead>

                <tbody id="event-info">
                {% for i in tables.index %}
                    <tr>
                        <form action="/processor_detail" method="get">

                            {% for col in tables.columns.tolist()[0:] %}
                                <input type="hidden" name="{{ col }}" value="{{ tables.loc[i,col] }}">
                                <td>
                                    {% if tables.loc[i,col] == '-' %}
                                        <p></p>
                                    {% elif tables.loc[i,col] == '-1.00' %}
                                        <p></p>
                                    {% else %}
                                        {#                                {% tables.loc[i,col] %}#}
                                        <p>{{ tables.loc[i,col] }}</p>
                                    {% endif %}
                                </td>
                            {% endfor %}
                            <td>
                                <button type="submit" class="btn btn-outline-primary btn-sm">详情</button>
                            </td>
                        </form>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </div>

    <script type=text/javascript>
        function get_result() {
            document.crud_query.action = "/contrastscatter";
            document.crud_query.submit();
        }

    </script>

{% endblock %}